<template>
  <div class="app-container">
    <el-form :inline="true">
      <el-form-item
        ><el-input placeholder="请输入姓名或号码布"></el-input
      ></el-form-item>
      <el-form-item><el-button type="success">查询</el-button></el-form-item>
    </el-form>

    <el-table :data="tableData" style="width: 100%" class="table-box">
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column label="排名" align="center" type="index" width="50">
      </el-table-column>
      <el-table-column
        label="参赛号"
        align="center"
        prop="numberPlate"
        width="100"
      >
        <template slot-scope="scope">
          <span>{{ scope.row.numberPlate }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="姓名"
        align="center"
        prop="chipNumber"
        width="150"
      >
        <template slot-scope="scope">
          <span>{{ scope.row.chipNumber }}</span>
        </template>
      </el-table-column>
      <el-table-column label="性别" align="center" prop="phone" width="150">
        <template slot-scope="scope">
          <span>{{ scope.row.phone }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="项目"
        align="center"
        prop="chipAddress"
        width="100"
      >
        <template slot-scope="scope">
          <span>{{ scope.row.chipAddress }}</span>
        </template>
      </el-table-column>
      <el-table-column label="枪声成绩" align="center" prop="name" width="100">
        <template slot-scope="scope">
          <span>{{ scope.row.name }}</span>
        </template>
      </el-table-column>
      <el-table-column label="净成绩" align="center" prop="sex" width="150">
        <template slot-scope="scope">
          <span>{{ scope.row.sex }}</span>
        </template>
      </el-table-column>

      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button size="mini" type="primary" @click="handleClick(scope.row)"
            >详情</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 成绩查询对话框 -->
    <el-dialog title="成绩详情" :visible.sync="scoreDialogVisible">
      <el-row>
        <el-col :span="8"> 姓名： </el-col>
        <el-col :span="8"> 号码牌：</el-col>
        <el-col :span="8"> 个人成绩：</el-col>
      </el-row>

      <el-table :data="scoreDetailData.data">
        <el-table-column label="计时点"></el-table-column>
        <el-table-column label="打卡时间"></el-table-column>
        <el-table-column label="分段用时"></el-table-column>
        <el-table-column label="分段配速"></el-table-column>
      </el-table>
      <pagination
        v-show="scoreDetailData.total > 0"
        :total="scoreDetailData.total"
        :page.sync="scoreDetailData.pageNum"
        :limit.sync="scoreDetailData.pageSize"
        @pagination="scoreDetailData"
      />
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 总条数
      total: 20,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      tableData: [
        // {
        //   numberPlate: "2001",
        //   name: "文首名",
        //   chipNumber: "542740",
        //   chipAddress: "202103084814",
        //   phone: "15956306092",
        //   sex: "女",
        //   cardId: "111111111111111111",
        // },
        // {
        //   numberPlate: "2002",
        //   name: "王高华",
        //   chipNumber: "541993",
        //   chipAddress: "202103084529",
        //   phone: "15956306092",
        //   sex: "男",
        //   cardId: "111111111111111111",
        // },
        // {
        //   numberPlate: "2003",
        //   name: "韦文萍",
        //   chipNumber: "541992",
        //   chipAddress: "202103084528",
        //   phone: "15956306092",
        //   sex: "女",
        //   cardId: "111111111111111111",
        // },
        // {
        //   numberPlate: "2005",
        //   name: "王金枝",
        //   chipNumber: "542000",
        //   chipAddress: "202103084530",
        //   phone: "13965171783",
        //   sex: "女",
        //   cardId: "111111111111111111",
        // },
        // {
        //   numberPlate: "2006",
        //   name: "马庆兰",
        //   chipNumber: "542001",
        //   chipAddress: "202103084531",
        //   phone: "13605591037",
        //   sex: "女",
        //   cardId: "111111111111111111",
        // },
      ],
      scoreDetailData: {
        data: [],
        total: 30,
        pageNum: 1,
        pageSize: 10,
      },
      // 弹出图层是否显示
      scoreDialogVisible: false,
    };
  },
  methods: {
    handleClick(row) {
      this.scoreDialogVisible = true;
    },
  },
};
</script>

<style scoped lang="scss">
.el-row {
  margin-bottom: 20px;
}
</style>
